import request from '@/utils/request'

export const getRolePages = (data = {}) => {
  return request.post('/boss/role/getRolePages', {
    ...data
  })
}
export const saveOrUpdateRole = (data = {}) => {
  return request.post('/boss/role/saveOrUpdate', {
    ...data
  })
}
export const deleteRoleById = (id: string | number) => {
  return request.delete(`/boss/role/${id}`)
}
export const getMenuNodeList = () => {
  return request.get('/boss/menu/getMenuNodeList')
}
export const allocateRoleMenus = (data = {}) => {
  return request.post('/boss/menu/allocateRoleMenus', {
    ...data
  })
}
export const getRoleMenus = (roleId: string | number) => {
  return request.get('/boss/menu/getRoleMenus', {
    params: {
      roleId
    }
  })
}

export const getResourceNodeList = () => {
  return request.get('/boss/resource/getAll')
}
export const allocateRoleResources = (data = {}) => {
  return request.post('/boss/resource/allocateRoleResources', {
    ...data
  })
}
export const getRoleResources = (roleId: string | number) => {
  return request.get('/boss/resource/getRoleResources', {
    params: {
      roleId
    }
  })
}
